package com.jk.controller;

import com.jk.bean.Article;
import com.jk.bean.BiaoTi;

import com.jk.service.PankService;
import com.sun.org.apache.bcel.internal.generic.RETURN;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

import java.util.List;

@Controller
@RequestMapping("pank")
public class PankController {
    @Resource
    private PankService pankService;

    @ResponseBody
    @RequestMapping("queryPank")
    public List<BiaoTi> queryPank() {
        return pankService.queryPank();
    }


    @ResponseBody
    @RequestMapping("queryDay")
    public List<BiaoTi> queryDay() {
        return pankService.queryDay();
    }

    @ResponseBody
    @RequestMapping("queryMonth")
    public List<BiaoTi> queryMonth() {
        return pankService.queryMonth();
    }


    @RequestMapping("toString")
    public String toString(String biaoti, String author, Model mo) {

        mo.addAttribute("bt", biaoti);
        mo.addAttribute("authorName", author);
        return "/information";
    }


    @ResponseBody
    @RequestMapping("queryMongo")
    public List<Article> queryMongo(String name) {

        return pankService.queryMongo(name);
    }

    @ResponseBody
    @RequestMapping("queryAuthor")
    public List<BiaoTi> queryAuthor(String author){
       return pankService.queryAuthor(author);
    }
}
